<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>RoleRealm - 登录</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'PingFang SC', 'Inter', sans-serif;
            background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
            min-height: 100vh;
            display: flex;
            flex-direction: column;
        }

        .header {
            padding: 20px 0;
            text-align: center;
        }

        .logo {
            color: white;
            font-size: 32px;
            font-weight: bold;
            margin-bottom: 8px;
        }

        .tagline {
            color: #e5e7eb;
            font-size: 16px;
        }

        .nav-links {
            margin-top: 20px;
        }

        .nav-links a {
            color: #e5e7eb;
            text-decoration: none;
            margin: 0 15px;
            font-size: 14px;
        }

        .nav-links a:hover {
            color: #f59e0b;
        }

        .main-content {
            flex: 1;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 40px 20px;
        }

        .login-container {
            background: rgba(255, 255, 255, 0.1);
            backdrop-filter: blur(10px);
            border-radius: 20px;
            padding: 40px;
            width: 100%;
            max-width: 400px;
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
        }

        .login-title {
            color: white;
            font-size: 28px;
            font-weight: bold;
            text-align: center;
            margin-bottom: 30px;
        }

        .form-group {
            margin-bottom: 20px;
        }

        .form-label {
            color: #e5e7eb;
            font-size: 14px;
            margin-bottom: 8px;
            display: block;
        }

        .form-input {
            width: 100%;
            padding: 12px 16px;
            border: 2px solid rgba(255, 255, 255, 0.2);
            border-radius: 10px;
            background: rgba(255, 255, 255, 0.1);
            color: white;
            font-size: 16px;
            transition: all 0.3s ease;
        }

        .form-input::placeholder {
            color: #9ca3af;
        }

        .form-input:focus {
            outline: none;
            border-color: #f59e0b;
            box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
        }

        .forgot-password {
            text-align: right;
            margin-bottom: 20px;
        }

        .forgot-password a {
            color: #f59e0b;
            text-decoration: none;
            font-size: 14px;
        }

        .login-btn {
            width: 100%;
            padding: 14px;
            background: #f59e0b;
            color: white;
            border: none;
            border-radius: 10px;
            font-size: 16px;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s ease;
            margin-bottom: 20px;
        }

        .login-btn:hover {
            background: #d97706;
            transform: translateY(-2px);
        }

        .login-btn:active {
            transform: translateY(0);
        }

        .register-link {
            text-align: center;
            color: #e5e7eb;
            font-size: 14px;
        }

        .register-link a {
            color: #f59e0b;
            text-decoration: none;
            font-weight: bold;
        }

        .footer {
            text-align: center;
            padding: 20px;
            color: #9ca3af;
            font-size: 14px;
        }

        .loading {
            display: none;
            text-align: center;
            color: #f59e0b;
            margin-top: 10px;
        }

        .spinner {
            border: 2px solid rgba(245, 158, 11, 0.3);
            border-top: 2px solid #f59e0b;
            border-radius: 50%;
            width: 20px;
            height: 20px;
            animation: spin 1s linear infinite;
            display: inline-block;
            margin-right: 10px;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        .error-message {
            color: #ef4444;
            font-size: 12px;
            margin-top: 5px;
            display: none;
        }

        @media (max-width: 768px) {
            .login-container {
                margin: 20px;
                padding: 30px 20px;
            }
            
            .logo {
                font-size: 24px;
            }
            
            .tagline {
                font-size: 14px;
            }
        }
    </style>
</head>
<body>
    <header class="header">
        <div class="logo">RoleRealm</div>
        <div class="tagline">与历史人物对话，体验沉浸式角色扮演</div>
        <nav class="nav-links">
            <a href="#home">首页</a>
            <a href="#about">关于我们</a>
            <a href="#help">帮助</a>
        </nav>
    </header>

    <main class="main-content">
        <div class="login-container">
            <h1 class="login-title">登录</h1>
            <form id="loginForm">
                <div class="form-group">
                    <label class="form-label" for="email">邮箱/手机号</label>
                    <input type="text" id="email" class="form-input" placeholder="请输入邮箱或手机号" required>
                    <div class="error-message" id="emailError"></div>
                </div>
                
                <div class="form-group">
                    <label class="form-label" for="password">密码</label>
                    <input type="password" id="password" class="form-input" placeholder="请输入密码" required>
                    <div class="error-message" id="passwordError"></div>
                </div>
                
                <div class="forgot-password">
                    <a href="#forgot">忘记密码？</a>
                </div>
                
                <button type="submit" class="login-btn">登录</button>
                <div class="loading" id="loading">
                    <div class="spinner"></div>
                    正在登录...
                </div>
            </form>
            
            <div class="register-link">
                还没有账号？<a href="register.html">立即注册</a>
            </div>
        </div>
    </main>

    <footer class="footer">
        技术支持：support@rolerealm.com
    </footer>

    <script>
        document.getElementById('loginForm').addEventListener('submit', function(e) {
            e.preventDefault();
            
            const email = document.getElementById('email').value;
            const password = document.getElementById('password').value;
            const loading = document.getElementById('loading');
            const loginBtn = document.querySelector('.login-btn');
            
            // 显示加载状态
            loading.style.display = 'block';
            loginBtn.style.display = 'none';
            
            // 模拟登录过程
            setTimeout(() => {
                loading.style.display = 'none';
                loginBtn.style.display = 'block';
                
                // 模拟登录成功，跳转到角色选择页面
                window.location.href = 'character-selection.html';
            }, 2000);
        });

        // 表单验证
        document.getElementById('email').addEventListener('blur', function() {
            const email = this.value;
            const error = document.getElementById('emailError');
            
            if (!email) {
                error.textContent = '请输入邮箱或手机号';
                error.style.display = 'block';
            } else if (!/^[\w\.-]+@[\w\.-]+\.\w+$/.test(email) && !/^1[3-9]\d{9}$/.test(email)) {
                error.textContent = '请输入有效的邮箱或手机号';
                error.style.display = 'block';
            } else {
                error.style.display = 'none';
            }
        });

        document.getElementById('password').addEventListener('blur', function() {
            const password = this.value;
            const error = document.getElementById('passwordError');
            
            if (!password) {
                error.textContent = '请输入密码';
                error.style.display = 'block';
            } else if (password.length < 6) {
                error.textContent = '密码长度至少6位';
                error.style.display = 'block';
            } else {
                error.style.display = 'none';
            }
        });
    </script>
</body>
</html>
